import React from 'react'

import axios from 'axios'


export default class ApiCom extends React.Component {


    constructor() {
        super()
        this.state = {
            list: [],
            serverList:''
        }
    }


    componentDidMount() {


        fetch('https://locally.uieee.com/slides')
            .then(res => res.json())

            .then(res => {
                console.log(res)
                this.setState({
                    list: res
                })
            })


            axios.get('https://locally.uieee.com/categories')
            .then(res=>{
                console.log(res.data)
            })



        

            fetch('/api/list')
            .then(res => res.json())

            .then(res => {
                console.log(res)
                this.setState({
                    serverList: res
                })
            })

    }


    render() {


        let { list } = this.state
        return (
            <div>
                <h2>ApiCom  组件 </h2>

                <ul>

                    {list.map((v, index) => {
                        return (

                            <li key={index}>

                                <img src={v.image} alt="" />
                            </li>
                        )

                    })}

                </ul>

            </div>
        )
    }
}